/**
 * Created by cherryzou on 2018/3/11.
 */
import React, { Component } from 'react';
import {
    ToolbarAndroid,
    AppRegistry,
    StyleSheet,
    Text,
    View,
    Image,
    TextInput,
    TouchableOpacity
} from 'react-native';
var Dimensions = require('Dimensions');
export  default class EditView extends Component{
    constructor(props){
        super(props);
        this.state = {text: ''};
    }

    render() {
        return (
            <View style={LoginStyles.TextInputView}>
                <Image source={this.props.srcs} style={LoginStyles.imageStyles}/>

                 <TextInput style={LoginStyles.TextInput}
                    placeholder={this.props.name}
                    placeholderTextColor={this.props.pColor}
                    underlineColorAndroid= "transparent"
                    secureTextEntry={this.props.isPwd}
                    onChangeText={
                    (text) => {
                       this.setState({text});
                       this.props.onChangeText(text);
                    }
              }

             />
                <View style={{display:this.props.isDisplay}}>
                    <TouchableOpacity  style={LoginStyles.SendButton} onPress={(text)=>{

                        this.setState({text});
                        this.props.onPressCallback(text);
                    }}>
                        <Text style={LoginStyles.SendText}>发送验证码</Text>
                    </TouchableOpacity>
                </View>
            </View>

    );
    }
}

const LoginStyles = StyleSheet.create({

    TextInputView: {
        flexDirection:"row",
        paddingLeft:10,
        paddingRight:10,
        height:50,
        justifyContent: 'center',
        alignItems:'center',
        borderColor:"#FFF",
        borderBottomWidth:1


    },

    TextInput: {
        flex:1,
        height:45,
        margin:18,
        color:"#FFF"
    },
    SendButton:{
        flexDirection: 'row',
        paddingTop:6,
        paddingBottom:6,
        paddingLeft:10,
        paddingRight:10,

        justifyContent: 'center',
        alignItems: 'center',
        borderColor:"#FFF",
        borderRadius: 2,
        borderWidth:1

    },
    SendText:{
        color:'#FFF'
    },
    imageStyles:{
        width:16,
        height:16,
        backgroundColor:'rgba(0,0,0,0)',
    }
});